package org.yty.travelagencyredis.service.impl;

import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import org.yty.travelagencyredis.Dao.ChatUserDao;
import org.yty.travelagencyredis.model.Entity.ChatUser;
import org.yty.travelagencyredis.service.ChatGroupMemberService;
import org.yty.travelagencyredis.service.ChatUserService;

import java.util.List;
import java.util.Optional;

@Service
@RequiredArgsConstructor
public class ChatUserServiceImpl implements ChatUserService {
    private final ChatUserDao chatUserDao;
    @Lazy
    @Autowired
    private ChatGroupMemberService chatGroupMemberService;

    @Override
    public List<ChatUser> getListByIdList(List<String> chatUserIdList) {
        return this.chatUserDao.selectByIdList(chatUserIdList);
    }

    @Override
    public ChatUser getById(String id) {
        return this.chatUserDao.selectById(id);
    }

    @Override
    public void deleteById(String id) {
        this.chatUserDao.deleteById(id);
        this.chatGroupMemberService.deleteByChatUserId(id);
    }
}
